package odch;

use strict;
use warnings;

use Log::Log4perl qw(:easy);
use Data::Dumper;
use JSON;
Log::Log4perl->easy_init($DEBUG);

sub forward_to_hub {
	no strict 'refs';
	my $method = shift;
	*{"odch::$method"} = sub {
		my $message = encode_json([$method, [@_]]);
		$::current_client->put("$message\n");
	};
}

map { forward_to_hub($_) } qw(
	register_script_name

	data_to_all
	data_to_user

	kick_user
	force_move_user

	add_ban_entry
	remove_ban_entry

	add_reg_user
	remove_reg_user
);

1;
